// 面包屑组件
import { useNavigate, Outlet, NavLink, useLocation } from 'react-router-dom';
import { Breadcrumb } from 'antd';

const Breadcrumbbb = (props:any) => {
  const itemRender = (route: any, params: any, routes: any, paths: any) => {
    let len = routes.length
    const last = routes[len - 1].path === location.pathname ? true : false;
    // const last = routes.indexOf(route) === routes.length - 1;
    return last ? (
      <span>{route.name}</span>
    ) : (
      <NavLink to={route.path}>{route.name}</NavLink>
    );
  }

  return (<div >
    {/* 面包屑 */}
    <Breadcrumb itemRender={itemRender} routes={props.matches} className='Breadcrumb' />
  </div>);
}
export default Breadcrumbbb;